package reflection.dproxy.simplelog;

import java.lang.reflect.InvocationHandler;
import java.lang.reflect.Method;

public class UserServiceLogger implements InvocationHandler {

    UserService userService = new SimpleUserService();
    
    @Override
    public Object invoke(Object proxy, Method method, Object[] args) throws Throwable {
        System.out.println("Before calling " + method.getName());
        Object retVal = method.invoke(userService, args);
        System.out.println("After calling " + method.getName());
        return retVal;
    }

}
